﻿tinyMCE.init({
    mode : "exact",
    elements : "Not_YET",
    theme : "advanced",
    plugins : "emotions,contextmenu,fullscreen,advhr,advimage,advlink,preview",
    theme_advanced_toolbar_location : "top",
	theme_advanced_toolbar_align : "left",
	theme_advanced_statusbar_location : "bottom",
    theme_advanced_buttons3_add : "emotions,fullscreen,preview,separator",
    external_image_list_url : "../images.ashx?status=images"
});

function enableEdit(cId) {
   tinyMCE.execCommand('mceAddControl', true, cId);
}

function enterValues() {
    $('loadermsg').innerHTML='Saving...';
    if($F('txtPage_Id')=='')
    {
        var data='Has_Article='+$F('txtHas_article')+'&Menu_title='+$F('txtMenu_title')+'&title='+$F('txtTitle')+'&content='+tinyMCE.getContent()+'&date='+$F('txtDate_Added');
        var myAjax = new Ajax.Request(
            '../handlers/callback.ashx?status=page&mode=insert',
            {method: 'post', parameters: data, onComplete: valuesEntered}
        );
    }
    else
    {
        var data='page_Id='+$F('txtPage_Id')+'&Has_Article='+$F('txtHas_article')+'&Menu_title='+$F('txtMenu_title')+'&title='+$F('txtTitle')+'&content='+tinyMCE.getContent()+'&date='+$F('txtDate_Added');
        var myAjax = new Ajax.Request(
            '../handlers/callback.ashx?status=page&mode=update',
            {method: 'post', parameters: data, onComplete: valuesEntered}
        );
    }
}

function valuesEntered(originalRequest) {
    $('loadermsg').innerHTML=originalRequest.responseText;
    Form.reset($('frmAdminPage'));
}

